package tool

import (
	"github.com/zeromicro/go-zero/core/stores/redis"
	"gorm.io/gorm"

	"github.com/zeromicro/go-zero/core/stores/cache"
	"github.com/zeromicro/go-zero/core/syncx"
)

func NewZeroCache(c cache.CacheConf, opts ...cache.Option) cache.Cache {
	barrier := syncx.NewSingleFlight()
	stats := cache.NewStat("survey")
	return cache.New(c, barrier, stats, gorm.ErrRecordNotFound, opts...)
}

func NewZeroRedis(c redis.RedisConf) *redis.Redis {
	rds, _ := redis.NewRedis(c)
	return rds
}
